package com.sky.demo.java.stream;

import java.util.ArrayList;
import java.util.IntSummaryStatistics;
import java.util.List;
import java.util.stream.Collectors;

public class StreamTest {

    public static void main(String[] args) {
        List<String> str = new ArrayList<>();


        IntSummaryStatistics statistics = str.stream().collect(Collectors.summarizingInt(String::length));

        //获取平均值
        double averageWordLength = statistics.getAverage();

        //获取最大值
        double maxWordLength = statistics.getMax();

        //获取最小值
        double minWordLength = statistics.getMin();

        //统计数量
        long count = statistics.getCount();

        //拼接字符串
        String result = str.stream().map(Object::toString).collect(Collectors.joining(", "));
    }
}
